Skip to main content

Events

Videocall Events

It's possible to handle several events from SDK:

- videocall_requested
- videocall_cancelled_user
- videocall_professional_ready
- videocall_cancelled_time_expired
- videocall_user_joined
- videocall_finished
- videocall_cancelled_professional_busy
- videocall_error_network
- videocall_error_system
- videocall_cancelled_user_requested_new

Events Implementing

The events are captured via BroadcastReceiver. All the events have the same properties "eventType" and “videocall_response”.

// 1. Create your broadcast receiver
class EventAppBroadcastReceiver : BroadcastReceiver() {
var eventProperties: Bundle? = null

override fun onReceive(context: Context?, intent: Intent) {
// Capturing bundle from the intent
eventProperties = intent.extras

//e.g Log message with info related to Videocall event
Log.i(
"[EVENTS VIDEOCALL]",
"Videocall: " + eventProperties.getString("eventType")
)
val videocallInfoResponse = eventProperties.getSerializable("videocall_response") as VideocallInfoResponse
}
}

// 2. Declare your BroadcastReceiver on your Activity
val eventAppBroadCastReceiver: BroadcastReceiver = EventAppBroadcastReceiver()

// 3. Register your BroadcastReceiver, e.g. on your OnResume() method
LocalBroadcastManager.getInstance(this).registerReceiver(eventAppBroadCastReceiver,
IntentFilter(getString(R.string.meetingdoctors_vc_local_broadcast_videocall_events)))

// Optional. If its needed to stop capturing events, unregister your Broadcastreceiver, e.g. on your OnPause() method
LocalBroadcastManager.getInstance(this).unregisterReceiver(eventAppBroadCastReceiver)